<#include "/common/layout.ftl"/>
<@layout "首页">
  <#include "/common/header-panel.ftl"/>

  <div class="layui-container">
    <div class="layui-row layui-col-space15">


      <div class="layui-col-md8">
        <div class="fly-panel">
          <div class="fly-panel-title fly-filter">
            <a>置顶</a>
            <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">去签到</a>
          </div>
          <ul class="fly-list">
            <@posts size=4 level=1>
              <#list results.list as post>
                <@pageList post></@pageList>
              </#list>

            </@posts>

          </ul>
        </div>

        <div class="fly-panel" style="margin-bottom: 0;">

          <div class="fly-panel-title fly-filter">
            <a href="" class="layui-this">综合</a>
            <span class="fly-mid"></span>
            <a href="">未结</a>
            <span class="fly-mid"></span>
            <a href="">已结</a>
            <span class="fly-mid"></span>
            <a href="">精华</a>
            <span class="fly-filter-right layui-hide-xs">
            <a href="" class="layui-this">按最新</a>
            <span class="fly-mid"></span>
            <a href="">按热议</a>
          </span>
          </div>

          <ul class="fly-list">
              <#list pageData.list as post>
                <@pageList post></@pageList>
              </#list>

          </ul>

           <@paging pageData></@paging>
        </div>
      </div>
      <#include "/common/right.ftl"/>

    </div>
  </div>
</@layout>


<script src="/res/layui/layui.js"></script>
<script>
  layui.cache.page = 'user';
</script>
<script>
  layui.use('laypage', function(){
    var laypage = layui.laypage;

    //执行一个laypage实例
    laypage.render({
      elem: 'fenye' //注意，这里的 test1 是 ID，不用加 # 号
      ,count: ${pageData.total} //数据总数，从服务端得到
      ,curr: ${pageData.pageNum}
      ,limit: ${pageData.size}
      ,jump: function(obj, first){
        //obj包含了当前分页的所有参数，比如：
        console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。


        //首次不执行
        if(!first){
          location.href='?pageNum='+obj.curr;
        }
      }
    });
  });
</script>